<template>
  <view class="registration-form-page">
    <view class="bt">赛事详情</view>
    <view class="cell-group">
      <view class="cell">
        <view class="label">报名赛事</view>
        <view class="value">{{detail.activity.title}}</view>
      </view>
    </view>
    <view class="bt">个人信息</view>
    <view class="cell-group">
      <view v-for="item in user" :key="item.prop" class="cell">
        <view class="label">{{item.label}}</view>
        <view class="value">{{item.value}}</view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        detail:{ activity: {} },
        user: []
      }
    },
    onLoad(e){
      this.register_id = e.id;
      this.$api.activityRegisterInfoApi({ register_id: e.id }).then(res=>{
        this.detail = res.data;
        this.user = [];
        res.data.activity_field.forEach(v => {
          const obj = { label: v.field_label, prop: v.field_name, value: '' };
          const target = res.data.fields.find(s => s.field_id === obj.prop);
          obj.value = target?.field_value || '';
          this.user.push(obj);
        });
      })
    },
    methods: {
      
    }
  }
</script>

<style lang="scss" scoped>
.registration-form-page {
  .bt {
    line-height: 80rpx;
    color: #666666;
    padding: 0 32rpx;
    box-sizing: border-box;
    font-size: 26rpx;
    background-color: #f7f7f7;
  }
  .cell-group {
    background-color: #fff;
    .cell {
      @include flex;
      color: #333333;
      font-size: 26rpx;
      line-height: 88rpx;
      padding: 0 32rpx;
      border-bottom: 1px solid #eee;
      &:last-child {
        border-bottom: none;
      }
      .label {
        width: 214rpx;
      }
      .value {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: right;
      }
    }
  }
}
</style>
